﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;

/// <summary>
/// Summary description for Alert
/// </summary>
public class Alert
{
	//
	// TODO: Add constructor logic here
	//

    public static void Show(string msg)
    {
        string cleanMsg = msg.Replace("'", "\'");
        
        string script = "<script type=\"text/javascript\">alert('" + cleanMsg + "');</script>";
        
        Page p = HttpContext.Current.CurrentHandler as Page;

        if (p != null && !p.ClientScript.IsClientScriptBlockRegistered("alert"))
        {
            p.ClientScript.RegisterClientScriptBlock(typeof(Alert), "alert", script);
        }
    }
}